//
//  SNPlanListLabel.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/12/25.
//  Copyright © 2016年 stone. All rights reserved.
//

#import "SNPlanListLabel.h"

//#define PADDING 8.0
//#define CORNER_RADIUS 4.0

@interface SNPlanListLabel()
/** contentInset */
@property (nonatomic, assign) UIEdgeInsets contentInset;
@end
@implementation SNPlanListLabel

- (void)drawRect:(CGRect)rect {
    
    UIEdgeInsets insets = {_PADDING,_PADDING, _PADDING, _PADDING};
    return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
}
- (CGSize)intrinsicContentSize {
    CGSize intrinsicSuperViewContentSize = [super intrinsicContentSize] ;
    intrinsicSuperViewContentSize.width += _PADDING * 2 ;
    intrinsicSuperViewContentSize.height += _PADDING * 2;
    return intrinsicSuperViewContentSize ;
}
-(void)setPADDING:(CGFloat)PADDING{
    _PADDING = PADDING;
    
    [self setNeedsDisplay];
}
/**
 *  设置边框宽度
 *
 *  @param borderWidth 可视化视图传入的值
 */
- (void)setBorderWidth:(CGFloat)borderWidth {
    
    if (borderWidth < 0) return;
    
    self.layer.borderWidth = borderWidth;
}

/**
 *  设置边框颜色
 *
 *  @param borderColor 可视化视图传入的值
 */
- (void)setBorderColor:(UIColor *)borderColor {
    
    self.layer.borderColor = borderColor.CGColor;
}

/**
 *  设置圆角
 *
 *  @param cornerRadius 可视化视图传入的值
 */
- (void)setCornerRadius:(CGFloat)cornerRadius {
    
    self.layer.cornerRadius = cornerRadius;
    self.layer.masksToBounds = cornerRadius > 0;
}
//sn_note:=========  ============================ stone 🐳 ===========/
@end
